package com.module.lemlin.view

import com.module.lemlin.base.BaseApplication
import org.greenrobot.eventbus.EventBus

object LoginAuthPopup {

    private var mDialogHintPopup: DialogHintPopup? = null

    fun show() {
        mDialogHintPopup = DialogHintPopup(
            context = BaseApplication.INSTANCE,
            onConfirm = {
                EventBus.getDefault().post(Action.ACTION_LOGIN_GO)
            },
            onCancel = {
                mDialogHintPopup?.dismiss()
            })
        mDialogHintPopup?.setTextMessage("请登录后操作！")?.setTextConfirm("去登录")
            ?.setOutSideDismiss(false)
            ?.setBackPressEnable(false)
            ?.setOverlayNavigationBar(true)
            ?.showPopupWindow()
    }

    fun hide() {
        mDialogHintPopup?.dismiss()
    }

    val isShowing: Boolean
        get() = mDialogHintPopup?.isShowing ?: false

    enum class Action {
        ACTION_LOGIN_GO, ACTION_LOGIN_SUCCESS
    }

}